package net.wsfcp.android.http.mvp.presenter;

import net.wsfcp.android.base.BasePresenter;
import net.wsfcp.android.bean.resultbean.DrawerBean;
import net.wsfcp.android.http.mvp.contract.DrawerContract;
import net.wsfcp.android.http.mvp.model.DrawerModel;
import net.wsfcp.android.http.mvp.IModel;
import net.wsfcp.android.ui.view.main.fragment.DrawerFragment;

import java.util.HashMap;
//首页侧滑
public class DrawerPresenter extends BasePresenter<DrawerFragment> implements
        DrawerContract.DrawerPresenter {

    @Override
    public void getDrawer() {

        ((DrawerModel) getiModelMap().get("drawer")).getDrawer(new DrawerModel.DrawerInfoHint() {
            @Override
            public void getDrawerSuccess(DrawerBean drawerBean) {
                getIView().getDrawerSuccess(drawerBean);  //成功
            }

            @Override
            public void getDrawerFail(String str) {
                getIView().getDrawerFail(str);  //成功
            }
        });

    }


    @Override
    public HashMap<String, IModel> getiModelMap() {
        return loadModelMap(new DrawerModel());
    }

    @Override
    public HashMap<String, IModel> loadModelMap(IModel... models) {
        HashMap<String, IModel> map = new HashMap<>();
        map.put("drawer", models[0]);
        return map;
    }


}
